package com.example.interpreter;

import java.util.ArrayList;
import java.util.Map;

public class OrExpression implements Expression {

    private ArrayList<Expression> expressions = new ArrayList<>();

    public OrExpression(String rule) {
        for (String s : rule.split("\\|\\|")) {
            expressions.add(new AndExpression(s));
        }
    }

    @Override
    public boolean interpret(Map<String, Integer> stat) {
        for (Expression e : this.expressions) {
            if (e.interpret(stat)) {
                return true;
            }
        }
        return false;
    }
    
}
